#include <map>
#include <iostream>
#include <string>
#include <time.h>
#include <stdio.h>
#include <map>
#include <vector>
#include "mdbHashtable.h"

using namespace std;

int main(int argc, char* argv[])
{
    map<int, int> intMap;
    TMdbHashtable<TMdbInt32Helper, int> intMdbhashTable;
    const int iTestCount = 100000;
    const int iTestTimes = 10;
    time_t ttBegin = time(NULL);
    for (int i = 0; i < iTestCount; i++)
    {
        intMap[i] = i;
    }
    time_t ttEnd = time(NULL);
    cout << "insert map:" <<ttEnd - ttBegin << endl;

    ttBegin = time(NULL);
    for (int i = 0; i < iTestCount; i++)
    {
        intMdbhashTable.put(i, i);
    }
    ttEnd = time(NULL);
    cout << "insert hashtable:" << ttEnd - ttBegin << endl;

    ttBegin = time(NULL);
    for (int iTimes = 0; iTimes < iTestTimes; iTimes++)
    {
        for (int i = 0; i < iTestCount; i++)
        {
            intMap.find(i);
        }
    }
    ttEnd = time(NULL);
    cout << "find map:" << ttEnd - ttBegin << endl;

    ttBegin = time(NULL);
    for (int iTimes = 0; iTimes < iTestTimes; iTimes++)
    {
        for (int i = 0; i < iTestCount; i++)
        {
            *(intMdbhashTable[i]);
        }
    }
    ttEnd = time(NULL);
    cout << "find hashtable:" << ttEnd - ttBegin << endl;

    return 0;
}